<?php

use App\Http\Controllers\FrontController;
use App\Http\Controllers\MasterController;
use App\Http\Controllers\UserController;
use App\Http\Controllers\VideoController;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/login',[UserController::class,'login'])->name('login');
Route::post('/login',[UserController::class,'doLogin']);
Route::get('/logout',[UserController::class,'logout'])->middleware('auth');

Route::prefix('adm')->group(function (){
    Route::get('/index',[UserController::class,'index'])->middleware('auth');;
    Route::get('/list',[UserController::class,'list']);
    Route::get('/user_create',[UserController::class,'create']);
    Route::post('/user_create',[UserController::class,'store']);//新增用户处理逻辑
    Route::get('/user_edit/{id}',[UserController::class,'edit']);
    Route::post('/user_edit/{id}',[UserController::class,'update']);
    Route::get('/user/{id}',[UserController::class,'destroy']);
    Route::get('/master-list',[UserController::class,'form']);
    Route::get('/master-create',[MasterController::class,'create']);
    Route::post('/master-create',[MasterController::class,'store']);
    Route::get('/master-edit/{id}',[MasterController::class,'edit']);
    Route::post('/master-edit/{id}',[MasterController::class,'update']);
    Route::post('/master-upload-thumb',[MasterController::class,'upload']);
    Route::get('/master-delete/{id}',[MasterController::class,'delete']);
    Route::get('/video-list',[VideoController::class,'index']);
    Route::get('/video-create',[VideoController::class,'create']);
    Route::post('/video-create',[VideoController::class,'store']);
    Route::post('/video-upload-thumb',[VideoController::class,'upload']);
    Route::get('/video-edit/{id}',[VideoController::class,'edit']);
    Route::post('/video-edit/{id}',[VideoController::class,'update']);
    Route::get('/video-delete/{id}',[VideoController::class,'destroy']);
});

Route::get('/',[FrontController::class,'index']);
Route::get('/master',[FrontController::class,'master']);
Route::get('/master-lecture',[FrontController::class,'masterlecture']);
Route::get('/master-show/{id}',[FrontController::class,'mastershow']);
Route::get('/video',[FrontController::class,'video']);
Route::get('/video-show/{id}',[FrontController::class,'videoshow']);
